FROM python:3.11-slim

ENV PYTHONPATH=/app
WORKDIR /app

# Install Poetry
# 在安装Poetry前配置pip镜像
RUN pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tune.tsinghua.edu.cn


# Copy only dependency files first for better caching
COPY pyproject.toml poetry.lock* /app/

# Configure Poetry to not use a virtual environment
# RUN poetry config virtualenvs.create false \
#     && poetry install --no-interaction --no-ansi
RUN poetry config virtualenvs.create false \
    && poetry source add --priority=default mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \
    && poetry install --no-interaction --no-ansi


# Copy rest of the source code
COPY . /app/

# Default command (will be overridden by Docker Compose)
CMD ["python", "src/main.py"] 
